home *** CD-ROM | disk | FTP | other *** search
- /* star.c
- **
- ** FM - 12.08.92
- **
- ** Display a Star with a colorflow.
- **
- **
- ** (c) by VIONA-Development 1992/93
- **
- */
-
- #include <exec/types.h>
- #include <proto/exec.h>
- #include <egs/egsintui.h>
- #include <egs/proto/egsintui.h>
- #include <egs/egsgfx.h>
- #include <egs/proto/egsgfx.h>
- #include <egs/egs.h>
- #include <egs/proto/egs.h>
-
-
- /* die Zeiger auf unsere Libraries */
- struct Library *EGSIntuiBase;
- struct Library *EGSGfxBase;
- struct Library *EGSBase;
-
-
- /* Ausgabe eines regelmäßigen Sterns mit 4 Spitzen */
- void drawStar8( EG_RastPortPtr rp, long mx, long my, long h1, long h2 )
- {
- EG_AreaMove( rp, mx, my-h1 );
- EG_AreaDraw( rp, mx+h2, my-h2 );
- EG_AreaDraw( rp, mx+h1, my );
- EG_AreaDraw( rp, mx+h2, my+h2 );
- EG_AreaDraw( rp, mx, my+h1 );
- EG_AreaDraw( rp, mx-h2, my+h2 );
- EG_AreaDraw( rp, mx-h1, my );
- EG_AreaDraw( rp, mx-h2, my-h2 );
- EG_AreaEnd( rp );
- }
-
-
- /* und hier passiert etwas */
- #define MAX_SIZE 100
-
- void doThings( EI_WindowPtr window )
- {
- long size;
-
- for( size=MAX_SIZE; size>1; size-- )
- {
- EG_SetAPen( window->RPort, ((255*size)/MAX_SIZE)*0x1010000 + 0x0000ff00 );
- drawStar8( window->RPort, window->Width/2,window->Height/2, MAX_SIZE,size );
- }
- WaitPort( window->UserPort );
- }
-
-
- /* das Hauptprogramm */
- void main( int argc, char *argv[] )
- {
- static struct EI_NewWindow newWindow =
- {
- 50,30, 400,300,
- 0,0, 0,0,
- NULL,
- EI_WINDOWCLOSE | EI_WINDOWBACK | EI_WINDOWDRAG,
- NULL,
- "Testfenster",
- EI_SMART_REFRESH,
- EI_iCLOSEWINDOW,
- NULL,
- {0,0,0,0,0,0,0},
- NULL,
- NULL
- };
- EI_WindowPtr window;
-
- /* die Libraries öffnen */
- EGSIntuiBase = OpenLibrary( (UBYTE *)"egsintui.library", 0 );
- if ( EGSIntuiBase )
- {
- EGSGfxBase = OpenLibrary( (UBYTE *)"egsgfx.library", 0 );
- if ( EGSGfxBase )
- {
- EGSBase = OpenLibrary( (UBYTE *)"egs.library", 0 );
- if ( EGSBase )
- {
- window = EI_OpenWindow( &newWindow );
- if ( window )
- {
- doThings( window );
- EI_CloseWindow( window );
- }
- CloseLibrary( EGSBase );
- }
- CloseLibrary( EGSGfxBase );
- }
- CloseLibrary( EGSIntuiBase );
- }
- }
-